/* ============================================
   デジタル名刺 - スタイルシート (Refactored)
   ============================================ */

/* --- デザイントークン --- */
:root {
    /* カラーパレット */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);

    /* 背景 & テキスト */
    --bg-primary: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.35);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* ボーダー & シャドウ */
    --border-glass: rgba(255, 255, 255, 0.2);
    --border-glow: rgba(102, 126, 234, 0.4);
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-header: 0 4px 20px rgba(0, 0, 0, 0.3);

    /* レイアウト */
    --radius-sm: 8px;
    --radius-md: 16px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;

    /* アニメーション */
    --transition: 0.3s ease;
    --font-family: 'Noto Sans JP', -apple-system, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    perspective: 1000px; /* 3D効果用 */
}

/* --- 背景装飾 --- */
.background-gradient {
    position: fixed;
    inset: 0;
    background-color: #ffffff;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(102, 126, 234, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(255, 215, 0, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 1) 0%, rgba(245, 248, 255, 1) 100%);
    background-size: 100% 100%;
    z-index: -1;
    animation: bgLightPulse 8s ease-in-out infinite alternate;
}

@keyframes bgLightPulse {
    0% { opacity: 0.7; filter: brightness(100%) saturate(100%); }
    100% { opacity: 1; filter: brightness(105%) saturate(120%); }
}

/* --- コンポーネント: グラスカード --- */
.glass-card {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
    
    /* 3D効果の直接適用 */
    transform: perspective(1000px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
    transition: transform 0.2s ease-out, box-shadow 0.4s ease;
    
    /* floatingをtransform以外で制御して傾斜と共存させる */
    top: 0;
    animation: floatingEffect 6s ease-in-out infinite;
}

/* マウス位置を照らすスポットライト (暖色系に変更) */
.glass-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x) var(--mouse-y), rgba(255, 190, 100, 0.25) 0%, transparent 55%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
    z-index: 2;
    mix-blend-mode: multiply; /* テキストの視認性を高めるため、乗算モードまたは通常モードで調整。ここでは自然な色づきのため乗算を使用 */
}

.glass-card:hover::before {
    opacity: 1;
}

@keyframes floatingEffect {
    0%, 100% { top: 0; }
    50% { top: -12px; }
}

/* カードを走る光の筋 (暖色系) */
.glass-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 220, 150, 0.15), transparent);
    transform: rotate(45deg);
    animation: shine 6s infinite linear;
    pointer-events: none;
    z-index: 1;
}

@keyframes shine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.glass-card:hover {
    box-shadow: 0 25px 50px rgba(102, 126, 234, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
}

/* --- レイアウト構造 --- */
.container {
    width: 100%;
    max-width: 480px;
    padding: var(--spacing-md);
    padding-bottom: 4rem;
}

/* --- ヘッダー領域 --- */
.profile-header {
    position: fixed;
    top: var(--spacing-md);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - var(--spacing-md) * 2);
    max-width: calc(480px - var(--spacing-md) * 2);
    z-index: 100;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-header);
    overflow: hidden;
    background: white;
}

.cover-photo {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    object-fit: cover;
}

.profile-info-card {
    padding: var(--spacing-sm);
}

.profile-info-card .name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.profile-info-card .title {
    display: block;
    font-size: 1.1rem;
    color: #475569;
    font-weight: 400;
}

.profile-info-card .company {
    display: block;
    font-size: 1.1rem;
    color: #64748b;
}

/* --- 浮遊ボタン (FAB) --- */
.fab-container {
    position: absolute;
    right: 24px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.fab {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ff9a9e, #fbc2eb, #a6c1ee, #84fab0, #ffecd2, #ff9a9e);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
    animation: fabHueRotate 10s linear infinite, fabPulse 3s ease-in-out infinite;
}

.fab svg {
    width: 32px;
    height: 32px;
    color: #333;
}

.fab-label {
    margin-top: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

@keyframes fabHueRotate {
    to {
        filter: hue-rotate(360deg);
    }
}

@keyframes fabPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

/* --- セクション共通 --- */
.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-sm);
    color: var(--text-muted);
    text-transform: uppercase;
}

/* --- 相互リンク項目 --- */
.contact-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.contact-item:hover {
    background: white;
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.contact-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

.contact-value {
    font-size: 1.05rem;
    font-weight: 500;
}

/* --- SNSリンク --- */
.social-links {
    display: flex;
    gap: var(--spacing-sm);
}

.social-link {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    color: var(--text-primary);
}

.social-link svg {
    width: 28px;
    height: 28px;
}

.facebook {
    background: linear-gradient(135deg, #1877f222, #1877f211);
}

.facebook:hover {
    background: linear-gradient(135deg, #1877f244, #1877f233);
    border-color: #1877f2;
    transform: translateY(-2px);
}

.instagram {
    background: linear-gradient(135deg, #E1306C22, #F7701E11);
}

.instagram:hover {
    background: linear-gradient(135deg, #E1306C44, #F7701E33);
    border-color: #E1306C;
    transform: translateY(-2px);
}

/* --- リスト項目 (資格など) --- */
.certification-list {
    list-style: none;
    padding-left: 0.5rem;
}

.certification-list li {
    position: relative;
    padding-left: 1.2rem;
    margin-bottom: 0.5rem;
}

.certification-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.certification-list a {
    text-decoration: none;
    color: inherit;
}

.certification-list a:hover {
    color: #667eea;
    text-decoration: underline;
}

/* --- 自己紹介 --- */
.bio-content {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #334155;
}

/* --- フッター --- */
.footer {
    text-align: center;
    padding: 2rem 0;
    opacity: 0.7;
    font-size: 0.8rem;
}

/* --- アニメーション --- */
.animate-fade-in {
    opacity: 0;
    translate: 0 30px;
    scale: 0.98;
    animation: majesticFadeIn 1.2s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

@keyframes majesticFadeIn {
    0% {
        opacity: 0;
        translate: 0 30px;
        scale: 0.98;
        filter: blur(10px);
    }
    100% {
        opacity: 1;
        translate: 0 0;
        scale: 1;
        filter: blur(0);
    }
}

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

.delay-5 {
    animation-delay: 0.5s;
}

/* ============================================
   追加機能: ツールバー・モーダル・ダークモード
   ============================================ */

/* --- ツールバー --- */
.toolbar {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.icon-btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
}

/* --- モーダル共通 --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 360px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    animation: none; /* floatingEffectをモーダルでは無効化 */
    top: 0;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-text {
    margin-top: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* --- QRコード --- */
.qr-img {
    width: 200px;
    height: 200px;
    margin: 20px auto 0;
    display: block;
    border-radius: 8px;
    background: white;
    padding: 10px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

/* --- おみくじ --- */
.omikuji-container {
    padding: 20px 10px;
}

.omikuji-fortune {
    font-size: 3rem;
    font-weight: 700;
    color: #e53e3e; /* 朱色 */
    margin-bottom: 15px;
    font-family: serif;
    letter-spacing: 5px;
    text-shadow: 2px 2px 4px rgba(229, 62, 62, 0.2);
}

.omikuji-text {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.6;
}

/* --- ダークモード (夜の神社モード) --- */
[data-theme="dark"] .background-gradient {
    background-color: #050b14;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(102, 126, 234, 0.05) 0%, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(212, 175, 55, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, #0a1128 0%, #050b14 100%);
}

[data-theme="dark"] .glass-card {
    background: rgba(15, 23, 42, 0.65);
    border-color: rgba(212, 175, 55, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .glass-card::before {
    background: radial-gradient(circle at var(--mouse-x) var(--mouse-y), rgba(212, 175, 55, 0.15) 0%, transparent 55%);
    mix-blend-mode: screen;
}

[data-theme="dark"] .glass-card::after {
    background: linear-gradient(45deg, transparent, rgba(212, 175, 55, 0.1), transparent);
}

[data-theme="dark"] body {
    color: #f1f5f9;
}

[data-theme="dark"] .profile-info-card .name,
[data-theme="dark"] .profile-info-card .title,
[data-theme="dark"] .profile-info-card .company,
[data-theme="dark"] .bio-content,
[data-theme="dark"] .contact-label,
[data-theme="dark"] .section-title,
[data-theme="dark"] .social-link {
    color: #e2e8f0;
}

[data-theme="dark"] .contact-item {
    background: rgba(30, 41, 59, 0.5);
}

[data-theme="dark"] .contact-item:hover {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

[data-theme="dark"] .profile-header {
    background: #0f172a;
}

[data-theme="dark"] .icon-btn {
    background: rgba(15, 23, 42, 0.65);
    border-color: rgba(212, 175, 55, 0.2);
    color: #e2e8f0;
}

[data-theme="dark"] .icon-btn:hover {
    background: rgba(30, 41, 59, 0.9);
}