/* ========================================
   ContentFreaks デザインシステム v1.0
   統一されたデザイン原則とトークン
   ======================================== */

/* ===== 1. スペーシングシステム（8pxグリッド） ===== */
:root {
    /* 基本単位: 8px */
    --space-unit: 8px;
    
    /* スペーシングスケール（8pxベース） */
    --space-0: 0;
    --space-1: calc(var(--space-unit) * 0.5);   /* 4px */
    --space-2: var(--space-unit);                /* 8px */
    --space-3: calc(var(--space-unit) * 1.5);   /* 12px */
    --space-4: calc(var(--space-unit) * 2);     /* 16px */
    --space-5: calc(var(--space-unit) * 2.5);   /* 20px */
    --space-6: calc(var(--space-unit) * 3);     /* 24px */
    --space-7: calc(var(--space-unit) * 3.5);   /* 28px */
    --space-8: calc(var(--space-unit) * 4);     /* 32px */
    --space-10: calc(var(--space-unit) * 5);    /* 40px */
    --space-12: calc(var(--space-unit) * 6);    /* 48px */
    --space-16: calc(var(--space-unit) * 8);    /* 64px */
    --space-20: calc(var(--space-unit) * 10);   /* 80px */
    --space-24: calc(var(--space-unit) * 12);   /* 96px */
    --space-32: calc(var(--space-unit) * 16);   /* 128px */
    
    /* レイアウト専用スペーシング */
    --layout-gutter: var(--space-4);           /* 16px */
    --layout-section: var(--space-20);         /* 80px */
    --layout-container-padding: var(--space-6); /* 24px */
}

/* ===== 2. タイポグラフィシステム（モジュラースケール） ===== */
:root {
    /* フォントファミリー */
    --font-primary: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: var(--font-primary);
    --font-mono: 'Monaco', 'Menlo', 'Courier New', monospace;
    
    /* ベースフォントサイズ */
    --font-base: 16px;
    
    /* タイポグラフィスケール（Major Third: 1.25倍） */
    --font-size-xs: 0.75rem;      /* 12px */
    --font-size-sm: 0.875rem;     /* 14px */
    --font-size-base: 1rem;       /* 16px */
    --font-size-md: 1.125rem;     /* 18px */
    --font-size-lg: 1.25rem;      /* 20px */
    --font-size-xl: 1.5rem;       /* 24px */
    --font-size-2xl: 1.875rem;    /* 30px */
    --font-size-3xl: 2.25rem;     /* 36px */
    --font-size-4xl: 3rem;        /* 48px */
    --font-size-5xl: 3.75rem;     /* 60px */
    --font-size-6xl: 4.5rem;      /* 72px */
    
    /* 行高（Line Height） */
    --line-height-tight: 1.2;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.6;
    --line-height-loose: 1.8;
    
    /* フォントウェイト */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-black: 900;
    
    /* レタースペーシング */
    --letter-spacing-tight: -0.02em;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.025em;
    --letter-spacing-wider: 0.05em;
    --letter-spacing-widest: 0.1em;
}

/* ===== 3. カラーシステム（整理・統一） ===== */
:root {
    /* ブランドカラー（プライマリ） */
    --color-primary-50: #fdfde8;
    --color-primary-100: #fbffc1;
    --color-primary-200: #f9ff86;
    --color-primary-300: #f7ff41;
    --color-primary-400: #f7ff0b;     /* メインカラー */
    --color-primary-500: #e6f000;
    --color-primary-600: #c8d100;
    --color-primary-700: #96a002;
    --color-primary-800: #777d08;
    --color-primary-900: #63660c;
    
    /* アクセントカラー（オレンジ） */
    --color-accent-50: #fff3ed;
    --color-accent-100: #ffe4d4;
    --color-accent-200: #ffc4a8;
    --color-accent-300: #ff9b71;
    --color-accent-400: #ff6b35;     /* メインアクセント */
    --color-accent-500: #fe4f1a;
    --color-accent-600: #ef3510;
    --color-accent-700: #c62610;
    --color-accent-800: #9d2216;
    --color-accent-900: #7e2016;
    
    /* グレースケール */
    --color-gray-50: #fafafa;
    --color-gray-100: #f5f5f5;
    --color-gray-200: #eeeeee;
    --color-gray-300: #e0e0e0;
    --color-gray-400: #bdbdbd;
    --color-gray-500: #9e9e9e;
    --color-gray-600: #757575;
    --color-gray-700: #616161;
    --color-gray-800: #424242;
    --color-gray-900: #212121;
    
    /* セマンティックカラー（意味を持つ色） */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;
    
    /* テキストカラー（アクセシビリティ考慮） */
    --color-text-primary: #1a202c;
    --color-text-secondary: #4a5568;
    --color-text-tertiary: #718096;
    --color-text-disabled: #a0aec0;
    --color-text-inverse: #ffffff;
    
    /* 背景カラー */
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f7fafc;
    --color-bg-tertiary: #edf2f7;
    --color-bg-inverse: #1a202c;
    
    /* ボーダーカラー */
    --color-border-light: #e2e8f0;
    --color-border-medium: #cbd5e0;
    --color-border-dark: #a0aec0;
}

/* ===== 4. シャドウシステム ===== */
:root {
    /* エレベーション（高さ）によるシャドウ */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    --shadow-none: none;
    
    /* カラーシャドウ */
    --shadow-primary: 0 8px 24px rgba(247, 255, 11, 0.3);
    --shadow-accent: 0 8px 24px rgba(255, 107, 53, 0.3);
}

/* ===== 5. ボーダーラディウス（角丸） ===== */
:root {
    --radius-none: 0;
    --radius-sm: 4px;
    --radius-base: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-3xl: 32px;
    --radius-full: 9999px;
}

/* ===== 6. トランジション ===== */
:root {
    /* 速度 */
    --duration-instant: 0ms;
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 350ms;
    --duration-slower: 500ms;
    
    /* イージング */
    --ease-linear: linear;
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* 組み合わせ */
    --transition-fast: var(--duration-fast) var(--ease-out);
    --transition-base: var(--duration-base) var(--ease-out);
    --transition-slow: var(--duration-slow) var(--ease-out);
}

/* ===== 7. Z-Index階層 ===== */
:root {
    --z-base: 0;
    --z-dropdown: 1000;
    --z-sticky: 1100;
    --z-fixed: 1200;
    --z-modal-backdrop: 1300;
    --z-modal: 1400;
    --z-popover: 1500;
    --z-tooltip: 1600;
    --z-toast: 1700;
    --z-max: 9999;
}

/* ===== 8. ブレークポイント（レスポンシブ） ===== */
:root {
    --breakpoint-xs: 480px;
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;
}

/* ===== 9. コンテナ幅 ===== */
:root {
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    --container-2xl: 1536px;
    --container-fluid: 100%;
}

/* ===== 10. タイポグラフィユーティリティクラス ===== */
.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-md { font-size: var(--font-size-md); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }
.text-4xl { font-size: var(--font-size-4xl); }
.text-5xl { font-size: var(--font-size-5xl); }
.text-6xl { font-size: var(--font-size-6xl); }

/* フォントウェイト */
.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }
.font-black { font-weight: var(--font-weight-black); }

/* 行高 */
.leading-tight { line-height: var(--line-height-tight); }
.leading-normal { line-height: var(--line-height-normal); }
.leading-relaxed { line-height: var(--line-height-relaxed); }
.leading-loose { line-height: var(--line-height-loose); }

/* ===== 11. スペーシングユーティリティクラス ===== */
/* マージン */
.m-0 { margin: var(--space-0); }
.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }
.m-6 { margin: var(--space-6); }
.m-8 { margin: var(--space-8); }

/* パディング */
.p-0 { padding: var(--space-0); }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* ギャップ（Flexbox/Grid） */
.gap-0 { gap: var(--space-0); }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ===== 12. カラーユーティリティクラス ===== */
/* テキストカラー */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-inverse { color: var(--color-text-inverse); }

/* 背景カラー */
.bg-primary { background-color: var(--color-bg-primary); }
.bg-secondary { background-color: var(--color-bg-secondary); }
.bg-tertiary { background-color: var(--color-bg-tertiary); }

/* ブランドカラー */
.text-brand { color: var(--color-primary-400); }
.bg-brand { background-color: var(--color-primary-400); }
.text-accent { color: var(--color-accent-400); }
.bg-accent { background-color: var(--color-accent-400); }

/* ===== 13. シャドウユーティリティ ===== */
.shadow-none { box-shadow: var(--shadow-none); }
.shadow-xs { box-shadow: var(--shadow-xs); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-2xl { box-shadow: var(--shadow-2xl); }

/* ===== 14. ボーダーラディウスユーティリティ ===== */
.rounded-none { border-radius: var(--radius-none); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded { border-radius: var(--radius-base); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

/* ===== 15. レスポンシブタイポグラフィ ===== */
.heading-1 {
    font-size: clamp(var(--font-size-3xl), 5vw, var(--font-size-5xl));
    font-weight: var(--font-weight-black);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
}

.heading-2 {
    font-size: clamp(var(--font-size-2xl), 4vw, var(--font-size-4xl));
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
}

.heading-3 {
    font-size: clamp(var(--font-size-xl), 3vw, var(--font-size-3xl));
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-normal);
}

.heading-4 {
    font-size: clamp(var(--font-size-lg), 2.5vw, var(--font-size-2xl));
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-normal);
}

.body-large {
    font-size: var(--font-size-md);
    line-height: var(--line-height-relaxed);
}

.body-base {
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
}

.body-small {
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
}

.caption {
    font-size: var(--font-size-xs);
    line-height: var(--line-height-normal);
    color: var(--color-text-secondary);
}

/* ===== 16. グリッドシステム（8pxベース） ===== */
.grid-container {
    display: grid;
    gap: var(--space-4);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }

/* ===== 17. Flexboxユーティリティ ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

/* ===== 18. アニメーション ===== */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(var(--space-4));
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-in {
    animation: fade-in var(--transition-base);
}

.animate-slide-up {
    animation: slide-up var(--transition-base);
}

.animate-scale-in {
    animation: scale-in var(--transition-base);
}
