/**
 * グローバルデザインシステム
 * 全ページ共通のデザイントークンと基本要素を定義
 *
 * トークン方針 (Issue #153):
 * - ライト＝昼のイノー（珊瑚礁内海の明るい海）、ダーク＝夜のイノー（星空の紺）
 * - ライト/ダークの切替はこのファイルの :root 再マップ1箇所のみで行う
 * - ページCSSは semantic トークン（--bg-* / --text-* / --accent 等）だけを使う
 */

/* ================================
   0. デザイントークン
   ================================ */

:root {
    color-scheme: light dark;

    /* -- プリミティブ（ブランド色） -- */
    --c-cyan-300: #8eeee7;   /* ライトアクア（浅瀬） */
    --c-cyan-500: #48CAE4;   /* シアンブルー（イノーの海） */
    --c-cyan-700: #0096C7;   /* ディープシアン（リーフの外） */
    --c-ice-200: #B0E0E6;    /* 月明かりのアクア */
    --c-navy-900: #0a0e27;   /* 夜のイノー */
    --c-navy-800: #151b3d;

    /* -- セマンティック（ページCSSが使ってよいのはここから下） -- */
    --bg-page: linear-gradient(135deg, #E3F2FD 0%, #FFFFFF 50%, #E0F7FA 100%);
    --bg-surface: rgba(255, 255, 255, 0.95);
    --bg-input: rgba(255, 255, 255, 0.9);
    --bg-input-focus: #ffffff;
    --bg-inset: rgba(72, 202, 228, 0.1);
    --bg-inset-strong: rgba(72, 202, 228, 0.2);

    --text-primary: #333333;
    --text-secondary: #555555;
    --text-muted: #666666;
    --text-on-accent: #ffffff;

    --heading: var(--c-cyan-700);
    --accent: var(--c-cyan-500);
    --accent-strong: var(--c-cyan-700);
    --accent-light: var(--c-cyan-300);
    --link: var(--c-cyan-500);
    --link-hover: var(--c-cyan-700);

    --border-soft: rgba(142, 238, 231, 0.2);
    --border-mid: rgba(142, 238, 231, 0.3);
    --border-strong: rgba(72, 202, 228, 0.3);

    --shadow-card: 0 4px 15px rgba(72, 202, 228, 0.1);
    --shadow-card-hover: 0 8px 25px rgba(72, 202, 228, 0.2);
    --shadow-panel: 0 5px 20px rgba(72, 202, 228, 0.15);
    --shadow-btn-hover: 0 5px 15px rgba(72, 202, 228, 0.3);
    --focus-ring: 0 0 0 3px rgba(72, 202, 228, 0.1);

    --grad-accent: linear-gradient(135deg, #48CAE4, #8eeee7);
    --grad-accent-hover: linear-gradient(135deg, #0096C7, #48CAE4);

    /* -- 形とリズム -- */
    --radius-card: 15px;
    --radius-panel: 20px;
    --radius-input: 10px;
    --radius-pill: 25px;
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 40px;
    --space-5: 64px;
    --container-max: 1200px;
    --measure: 68ch;

    /* -- タイプ -- */
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
    --font-display: "Zen Kaku Gothic New", "Noto Sans JP", var(--font-body);
    --font-serif: "Noto Serif JP", "Hiragino Mincho ProN", serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-page: linear-gradient(135deg, #0a0e27 0%, #151b3d 50%, #0a0e27 100%);
        --bg-surface: rgba(20, 30, 50, 0.95);
        --bg-input: rgba(30, 40, 60, 0.95);
        --bg-input-focus: rgba(40, 50, 70, 0.95);
        --bg-inset: rgba(176, 224, 230, 0.08);
        --bg-inset-strong: rgba(176, 224, 230, 0.16);

        --text-primary: #e0e0e0;
        --text-secondary: #c0c0c0;
        --text-muted: #c0c0c0; /* 旧ダーク実装の .card-excerpt と同値（パリティ維持） */

        --heading: var(--c-ice-200);
        --link: var(--c-cyan-500);
        --link-hover: var(--c-cyan-300);

        --border-soft: rgba(176, 224, 230, 0.2);
        --border-mid: rgba(176, 224, 230, 0.3);
        --border-strong: rgba(176, 224, 230, 0.4);

        --shadow-card: 0 4px 15px rgba(0, 0, 0, 0.5);
        --shadow-card-hover: 0 8px 25px rgba(0, 0, 0, 0.6);
        --shadow-panel: 0 5px 20px rgba(0, 0, 0, 0.5);
    }
}

/* ================================
   1. ベーススタイル
   ================================ */

/* 最小リセット（旧 Bootstrap CDN の reboot が担っていた分。PR7でCDN撤去） */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
}

/* 全ページ共通の背景とフォント */
body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary);
    background: var(--bg-page);
    min-height: 100vh;
}

/* メインコンテンツエリア */
.site-main,
main,
#primary,
.page-content,
.content-area {
    background: transparent;
    padding: 40px 0;
}

/* ================================
   2. タイポグラフィ
   ================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 300;
    letter-spacing: 0.5px;
    color: var(--heading);
    margin-bottom: 1.5rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

.page-title,
.section-title {
    font-size: 2rem;
    font-weight: 300;
    color: var(--heading);
    letter-spacing: 2px;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-mid);
}

p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

/* ================================
   3. コンテナとレイアウト
   ================================ */

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 20px;
}

.content-section {
    margin-bottom: 60px;
    padding: 40px 0;
}

/* ================================
   4. カードコンポーネント
   ================================ */

.card,
.event-card,
.bbs-post,
.tsuchida-card {
    background: var(--bg-surface);
    border-radius: var(--radius-card);
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    border: 1px solid var(--border-soft);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-strong);
}

.card-title {
    font-size: 1.25rem;
    color: var(--heading);
    margin-bottom: 10px;
    font-weight: 500;
}

.card-date,
.meta-info {
    color: var(--accent);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.card-excerpt,
.card-description {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 15px;
}

/* ================================
   5. ボタンとリンク
   ================================ */

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

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

.btn,
.button,
.card-link,
.read-more {
    display: inline-block;
    padding: 10px 24px;
    background: var(--grad-accent);
    color: var(--text-on-accent) !important;
    border-radius: var(--radius-pill);
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

/* view-more-linkは別スタイル（視認性重視） */
.view-more-link {
    display: inline-block;
    padding: 10px 24px;
    background: var(--bg-surface);
    color: var(--accent) !important;
    border-radius: var(--radius-pill);
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    border: 1px solid var(--border-strong);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(72, 202, 228, 0.15);
}

.btn:hover,
.button:hover,
.card-link:hover,
.read-more:hover {
    background: var(--grad-accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-btn-hover);
    color: var(--text-on-accent) !important;
}

.view-more-link:hover {
    background: var(--grad-accent);
    color: var(--text-on-accent) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-btn-hover);
    border-color: transparent;
}

/* セカンダリボタン */
.btn-secondary {
    background: var(--bg-inset);
    color: var(--accent) !important;
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    background: var(--bg-inset-strong);
    border-color: var(--accent);
}

/* ================================
   6. フォーム要素
   ================================ */

.form-control,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid var(--border-mid);
    border-radius: var(--radius-input);
    background: var(--bg-input);
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.form-control:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
    background: var(--bg-input-focus);
}

/* プレースホルダー（ダークでブラウザ既定色が沈むのを防ぐ） */
.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.75;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--heading);
    font-weight: 500;
}

/* ================================
   7. セクションヘッダー
   ================================ */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-mid);
}

/* ================================
   8. 特殊コンポーネント
   ================================ */

/* BBSフォーム・投稿フォーム */
.bbs-form,
.tsuchida-form,
.diary-form {
    background: var(--bg-surface);
    padding: 40px;
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-panel);
    border: 1px solid var(--border-soft);
}

/* プロフィールページ */
.profile-section {
    background: var(--bg-surface);
    padding: 40px;
    border-radius: var(--radius-panel);
    margin-bottom: 40px;
    box-shadow: var(--shadow-panel);
}

/* イベント・作品カード */
.event-item,
.work-item {
    background: var(--bg-surface);
    border-radius: var(--radius-card);
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
}

.event-item:hover,
.work-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-card-hover);
}

/* ================================
   9. レスポンシブ対応
   ================================ */

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    .card,
    .bbs-form,
    .tsuchida-form,
    .profile-section {
        padding: 20px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* ================================
   10. アニメーション
   ================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* ================================
   11. ユーティリティクラス
   ================================ */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

/*
 * かつてここにあった「TEMPダークカバレッジ」（核爆弾に詳細度で勝つ
 * ルート塗装・main塗装）は、PR7 の核爆弾解体で不要になり削除した。
 * ダークはファイル冒頭の :root 再マップだけで成立する。
 */
