/* File: css/style.css (Full Version 2.2) */

/* === 基本設定 === */
:root {
    --bg-color: #EFECE4;       /* アプリ内の明るいベージュ */
    --outer-bg-color: #D6D2C4; /* PC背景用の少し暗いベージュ */
    --text-color: #4A4A46;
    --app-max-width: 480px;    /* スマホ幅の定義 */
}

* { 
    -webkit-tap-highlight-color: transparent; 
    outline: none; 
    box-sizing: border-box; 
}

html, body { 
    margin: 0; padding: 0; width: 100%; height: 100%; 
    background-color: var(--outer-bg-color); /* PC背景色を修正 */
    overflow: hidden; 
    touch-action: none; 
    font-family: 'Josefin Sans', "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    color: var(--text-color);
}

/* === アプリコンテナ (スマホ特化レイアウト) === */
.app-container {
    width: 100%; height: 100%;
    max-width: var(--app-max-width);
    margin: 0 auto; /* 中央寄せ */
    background-color: var(--bg-color);
    position: relative;
    overflow: hidden;
    /* 修正: 影を柔らかく広げる */
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.15); 
}

body.modal-open .app-container {
    overflow: hidden;
}

/* === Landing Screen (Entry) === */
.landing-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-color);
    z-index: 3000; /* 最前面 */
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.landing-screen.hidden {
    opacity: 0; visibility: hidden; pointer-events: none;
}

.landing-content {
    text-align: center; padding: 40px;
    opacity: 0; transform: translateY(20px);
    animation: fadeInContent 1s 0.2s forwards ease-out;
}

@keyframes fadeInContent {
    to { opacity: 1; transform: translateY(0); }
}

.landing-content h1 {
    font-weight: 300; font-size: 24px; letter-spacing: 0.1em; margin-bottom: 10px;
}

.landing-content h2 {
    font-weight: 400; font-size: 14px; letter-spacing: 0.2em; opacity: 0.6;
    margin-bottom: 40px; line-height: 1.5; text-transform: uppercase;
}

.landing-content p {
    font-size: 13px; line-height: 2.0; opacity: 0.7; margin-bottom: 50px;
    font-family: "Hiragino Mincho ProN", serif; /* 日本語部分を明朝体に */
}

.entry-actions {
    display: flex; flex-direction: column; gap: 20px; align-items: center;
}

.entry-btn {
    background: none; border: 1px solid var(--text-color);
    border-radius: 50px;
    padding: 12px 30px;
    font-family: 'Josefin Sans', sans-serif;
    color: var(--text-color);
    cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    transition: all 0.3s ease;
    width: 240px; justify-content: center;
}

.entry-btn svg { width: 18px; height: 18px; }

.entry-btn.primary:hover {
    background: var(--text-color); color: var(--bg-color);
    transform: scale(1.05);
}

.entry-btn.secondary {
    border-color: transparent; opacity: 0.6; font-size: 13px;
}
.entry-btn.secondary:hover { opacity: 1; background: rgba(0,0,0,0.05); }

/* === ロゴ === */
.logo { 
    position: absolute; top: 30px; left: 30px; 
    font-weight: 300; font-size: 18px; letter-spacing: 0.05em; 
    z-index: 20; opacity: 0.9; pointer-events: none; 
}

/* === ノイズレイヤー === */
.noise-layer {
    position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    opacity: 0.08; pointer-events: none;
    background-image: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)" opacity="1"/%3E%3C/svg%3E');
    z-index: 100;
    mix-blend-mode: multiply;
    animation: noiseMove 0.5s steps(10) infinite;
}
@keyframes noiseMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(1px, 1px); }
}

/* === 滲み効果のラッパー === */
.grid-wrapper { 
    width: 100%; height: 100%; 
    display: flex; justify-content: center; align-items: center; 
    filter: blur(20px) contrast(1.2); 
    mix-blend-mode: multiply;
    transform: translateZ(0);
    opacity: 0; transition: opacity 2.0s ease; /* 初期非表示 */
}
.grid-wrapper.active { opacity: 1; }

/* === グリッドコンテナ === */
.grid-container { 
    display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); 
    width: 100vmax; height: 100vmax; 
    max-width: 800px; max-height: 800px; 
    /* 親がapp-containerでクリップされるため、ここは大きくてもOK */
    position: absolute; left: 50%; top: 50%; 
    transform: translate(-50%, -50%) rotate(-3deg); 
    gap: 0; 
}

/* === インタラクティブ・ボタン === */
.grid-item {
    position: relative; cursor: pointer;
    mix-blend-mode: screen; 
    opacity: 0.9; 
    width: 140%; height: 140%; 
    margin: -20%; 
    border: none; padding: 0; 
    transition: transform 0.2s ease-out; 
    /* アニメーションは初期停止、JSでクラス付与時に開始 */
    will-change: border-radius, transform;
    -webkit-tap-highlight-color: transparent;
}
.grid-item.animate {
    animation: organicMorph 14s ease-in-out infinite alternate;
}

.grid-item:active, .grid-item.active-state { 
    transform: scale(0.9) !important; 
    opacity: 1; filter: brightness(1.2); z-index: 10; 
}

@keyframes organicMorph {
    0% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: scale(1.0); }
    33% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; transform: scale(1.1); } 
    66% { border-radius: 70% 30% 50% 50% / 30% 50% 60% 40%; transform: scale(1.05); }
    100% { border-radius: 40% 60% 60% 40% / 60% 40% 40% 60%; transform: scale(1.15); }
}

.delay-1 { animation-delay: -1s; } .delay-2 { animation-delay: -3s; }
.delay-3 { animation-delay: -5s; } .delay-4 { animation-delay: -7s; }
.delay-5 { animation-delay: -2s; } .delay-6 { animation-delay: -4s; }
.delay-7 { animation-delay: -6s; } .delay-8 { animation-delay: -8s; }

.item-1 { background: radial-gradient(circle at center, rgba(180,195,205,0.4), rgba(60,95,125,0.8)); }
.item-2 { background: radial-gradient(circle at center, rgba(215,195,225,0.4), rgba(120,85,145,0.8)); }
.item-3 { background: radial-gradient(circle at center, rgba(195,215,205,0.4), rgba(75,125,105,0.8)); }
.item-4 { background: radial-gradient(circle at center, rgba(225,190,175,0.4), rgba(165,75,55,0.8)); }
.item-5 { background: radial-gradient(circle at center, rgba(225,195,205,0.4), rgba(185,85,115,0.8)); }
.item-6 { background: radial-gradient(circle at center, rgba(215,185,205,0.4), rgba(145,65,105,0.8)); }
.item-7 { background: radial-gradient(circle at center, rgba(225,215,175,0.4), rgba(175,165,65,0.8)); }
.item-8 { background: radial-gradient(circle at center, rgba(225,205,175,0.4), rgba(185,125,55,0.8)); }
.item-9 { background: radial-gradient(circle at center, rgba(235,215,165,0.4), rgba(205,165,55,0.8)); }

/* === コントロールボタン群 === */
.controls-container {
    position: absolute; /* fixedから変更（コンテナ内配置のため） */
    bottom: 30px; right: 30px;
    display: flex; flex-direction: column; gap: 15px;
    z-index: 1000;
    opacity: 0; pointer-events: none; transition: opacity 0.5s; /* 初期非表示 */
}
.controls-container.active { opacity: 1; pointer-events: auto; }

.circle-btn {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex; justify-content: center; align-items: center;
    transition: transform 0.3s ease, background 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    padding: 0; color: var(--text-color);
}
.circle-btn:hover { background: rgba(255, 255, 255, 0.5); transform: scale(1.1); }
.circle-btn svg { width: 24px; height: 24px; stroke-width: 1.5; }
.sound-off { display: none; }

/* === モーダル === */
.modal-overlay {
    position: absolute; /* fixedから変更 */
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(239, 236, 228, 0.95);
    backdrop-filter: blur(10px);
    z-index: 2000;
    opacity: 0; visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s;
    display: flex; justify-content: center; align-items: center;
    touch-action: pan-y;
    overflow: hidden; 
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-content {
    width: 100%; height: 100%;
    overflow-y: auto; 
    padding: 80px 40px 40px; 
    text-align: center; color: var(--text-color);
    position: relative;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.close-btn {
    position: absolute; /* fixedから変更 */
    top: 30px; right: 30px;
    width: 50px; height: 50px;
    background: none; border: none; font-size: 32px; cursor: pointer; color: var(--text-color);
    z-index: 2001; 
    opacity: 0.7; transition: opacity 0.3s;
    display: flex; justify-content: center; align-items: center;
}
.close-btn:hover { opacity: 1; }

.modal-section { margin-bottom: 60px; opacity: 0; transform: translateY(20px); transition: 0.6s ease; }
.modal-overlay.active .modal-section { opacity: 1; transform: translateY(0); }
.modal-overlay.active .modal-section:nth-child(2) { transition-delay: 0.1s; }
.modal-overlay.active .modal-section:nth-child(3) { transition-delay: 0.2s; }
.modal-overlay.active .modal-section:nth-child(4) { transition-delay: 0.3s; }

.modal-section h2 { 
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300; letter-spacing: 0.1em; margin-bottom: 24px; 
    display: inline-block; padding-bottom: 5px;
    font-size: 24px;
}

.outline-dl {
    display: grid; grid-template-columns: 80px 1fr; gap: 12px; margin: 0 auto; 
    max-width: 400px; text-align: left; font-size: 14px; line-height: 1.6;
}
.outline-dl dt { opacity: 0.6; font-weight: 300; }
.outline-dl dd { margin: 0; font-weight: 400; }

.apps-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* モバイル向け調整 */
    gap: 20px; width: 100%;
}
.app-card {
    width: 100%; border-radius: 12px; overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08); 
    background: transparent; line-height: 0; position: relative;
}
.app-card::after {
    content: "COMING SOON";
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    background: rgba(255,255,255,0.3); color: #fff; font-weight: 300; letter-spacing: 0.2em;
    opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.app-card img { width: 100%; height: auto; display: block; filter: grayscale(10%); transition: filter 0.3s, transform 0.5s; }
.app-card:hover img { filter: grayscale(0%); transform: scale(1.05); }
.app-card:hover::after { opacity: 1; }

.footer-note { font-size: 12px; opacity: 0.5; margin-top: 50px; padding-bottom: 20px; }
/* === Apps グリッド === */
.apps-grid {
    display: grid;
    /* モバイルで見やすいよう、最小幅を少し広げました */
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); 
    gap: 40px; /* アイテム間の余白を広めに */
    width: 100%;
    margin-bottom: 40px;
}

/* 各アプリのラッパー */
.app-item-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px; /* 画像とテキストの間隔 */
}

/* 画像カード */
.app-card {
    width: 100%; 
    border-radius: 12px; 
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08); 
    background: transparent; 
    line-height: 0; 
    position: relative;
    /* アスペクト比を維持するための設定（画像がない場合の崩れ防止） */
    aspect-ratio: 16 / 9; 
    background-color: #e0ded5; /* 画像読み込み前の背景色 */
}

.app-card::after {
    content: "OPEN"; /* ホバー時の文字を変更 */
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    background: rgba(255,255,255,0.3); 
    color: #fff; font-weight: 300; letter-spacing: 0.2em;
    opacity: 0; transition: opacity 0.3s; pointer-events: none;
}

.app-card img { 
    width: 100%; height: 100%; object-fit: cover; /* 枠いっぱいに表示 */
    display: block; 
    filter: grayscale(10%); 
    transition: filter 0.3s, transform 0.5s; 
}

.app-card.active-link:hover { cursor: pointer; }
.app-card.active-link:hover img { filter: grayscale(0%); transform: scale(1.05); }
.app-card.active-link:hover::after { opacity: 1; }

/* テキスト情報 */
.app-info {
    text-align: left;
    padding: 0 5px;
}

.app-title {
    font-size: 16px;
    font-weight: 400;
    margin: 0 0 8px 0;
    letter-spacing: 0.05em;
    color: var(--text-color);
}

.app-desc {
    font-size: 13px;
    line-height: 1.6;
    opacity: 0.7;
    margin: 0;
    font-weight: 300;
}

.footer-note { font-size: 12px; opacity: 0.5; margin-top: 50px; padding-bottom: 20px; }
