:root {
    --dark-space: #0F0E17;
    --light-glow: #a7c7e7;
    --bright-star: #FFFFF0;
    --gold-accent: #FFD700;

    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--dark-space);
    color: var(--bright-star);
    font-family: var(--font-body);
    line-height: 1.7;
    font-weight: 400;
    /* [変更点] スクロールバーは常に表示させてレイアウト崩れを防ぐ */
    overflow-y: scroll;
    cursor: none;
}

/* --- [変更点] 3D Canvas Container --- */
#three-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
}
#three-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* --- Custom Cursor --- */
.cursor-glow {
    position: fixed; width: 30px; height: 30px; border: 1px solid var(--light-glow); border-radius: 50%;
    left: 0; top: 0; pointer-events: none; transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease, background-color 0.3s ease; z-index: 9999;
}

/* --- [変更点] Header with Glassmorphism --- */
.site-header {
    position: fixed;
    width: 100%;
    padding: 2rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: background-color 0.4s ease, backdrop-filter 0.4s ease;
    
    /* 初期状態は透明 */
    background: rgba(15, 14, 23, 0);
    backdrop-filter: blur(0px);
}
.site-header.scrolled {
    /* Glassmorphism スタイルを適用 */
    background: rgba(15, 14, 23, 0.5);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(167, 199, 231, 0.1);
}

/* --- NEW: Header CTA + Focus UI --- */
/* --- Header CTA を nav-link と同系に統一 --- */
.header-cta {
    margin-left: 2.5rem;           /* nav-link に合わせて間隔を広めに */
    padding: 0.5rem 0;             /* テキストリンク風に */
    font-size: 1rem;
    font-weight: 400;
    color: var(--bright-star);
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
}

/* マウス操作では枠を出さず、キーボード操作(:focus-visible)時だけ枠を出す */
.header-cta:focus { outline: none; box-shadow: none; }
.header-cta:focus-visible {
  outline: 2px solid var(--light-glow);
  outline-offset: 2px;
}

.header-cta::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 0; height: 1px;
    background-color: var(--light-glow);
    transition: width 0.4s cubic-bezier(0.23,1,0.32,1);
}
.header-cta:hover::after { width: 100%; }

/* 押下状態の半透明は不要：削除 or 無効化 */
.header-cta[aria-pressed="true"] { opacity: 1; }

/* 背面の黄色いシェイプを禁止（背景を付けない） */
.header-cta:hover { transform: translateY(-2px); background: transparent; }
/* 押下時の不透明度は下と統一して 1 に */
.header-cta[aria-pressed="true"] { opacity: 1; cursor: default; }

.sphere-exit {
    position: fixed;
    top: 14px;
    right: 20px;
    z-index: 2000;
    padding: 0.35rem 0.6rem;
    font-size: 1rem;
    line-height: 1;
    color: rgba(255,255,240,.7);
    background: rgba(15, 14, 23, .35);
    border: 1px solid rgba(167,199,231,.25);
    border-radius: 6px;
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: opacity .25s ease, background-color .25s ease, border-color .25s ease;
}
.sphere-exit:hover {
    background: rgba(15, 14, 23, .55);
    border-color: rgba(167,199,231,.5);
    color: var(--bright-star);
}

/* --- NEW: Focus Mode Layering + Fades --- */
.site-header, .site-header .logo, .site-header nav, .header-cta, main, footer {
    transition:
      opacity   .75s cubic-bezier(0.16, 1, 0.3, 1),
      filter    .75s cubic-bezier(0.16, 1, 0.3, 1),
      transform .75s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, filter, transform;
}

/* わずかな段差（好みで数値は微調整可） */
body.sphere-focus .site-header nav { transition-delay: .01s; }
body.sphere-focus main            { transition-delay: .02s; }
body.sphere-focus footer          { transition-delay: .03s; }

/* フォーカス時はキャンバスを最前面へ */
body.sphere-focus #three-container { z-index: 1500; }

/* ページ要素は「ふわっと消える」＋操作不能に */
body.sphere-focus .site-header .logo,
body.sphere-focus .site-header nav,
body.sphere-focus .header-cta,
body.sphere-focus main,
body.sphere-focus footer {
    opacity: 0;
    filter: blur(3px);
    transform: scale(.98);
    pointer-events: none;
}

body.sphere-focus .site-header {
    background: rgba(15, 14, 23, 0); /* 完全透明 */
    backdrop-filter: blur(0);
    border-bottom-color: transparent;
    /* 修正点 */
    z-index: 1900;         /* three-container(1500)より上へ */
    pointer-events: auto;  /* ヘッダー自体はイベントを通す */
}

/* ☓ はフォーカス中だけ表示＆操作可能 */
body.sphere-focus .sphere-exit { display: inline-flex; pointer-events: auto; }
.sphere-exit[hidden] { display: none !important; }

/* フォーカス中はスクロール固定（Threeに集中） */
body.sphere-focus { overflow: hidden; }

/* Threeキャンバスも念のため操作しやすく */
body.sphere-focus #three-canvas { cursor: grab; }
body.sphere-focus #three-canvas:active { cursor: grabbing; }

.logo { font-family: var(--font-heading); font-size: 1.8rem; font-weight: 600; letter-spacing: 1px; }

.nav-link {
    color: var(--bright-star); text-decoration: none; margin-left: 2.5rem;
    font-size: 1rem; position: relative; padding: 0.5rem 0; letter-spacing: 0.5px;
}
.nav-link::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 1px;
    background-color: var(--light-glow); transition: width 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
.nav-link:hover::after { width: 100%; }

/* --- Sections --- */
main {
    position: relative; /* z-indexを効かせるため */
    z-index: 10;
    width: 100%;
    padding: 0 10%;
}

.hero-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.hero-section h1 {
    font-family: var(--font-heading); font-size: 4.5rem;
    line-height: 1.1; margin-bottom: 2rem; font-weight: 600;
}
.hero-section p { font-size: 1.2rem; max-width: 600px; margin-bottom: 2.5rem; }

.cta-button {
    font-family: var(--font-body); font-size: 1rem; font-weight: 600; color: var(--dark-space);
    background-color: var(--gold-accent); padding: 1rem 2.5rem; text-decoration: none;
    border-radius: 50px; transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: inline-block; border: 2px solid var(--gold-accent);
}
.cta-button:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(255, 215, 0, 0.2); }
.cta-button.outline { background-color: transparent; color: var(--gold-accent); }
.cta-button.outline:hover { background-color: var(--gold-accent); color: var(--dark-space); }

.content-section { padding: 10rem 0; }

.section-title { display: flex; align-items: center; margin-bottom: 3rem; }
.section-title h2 { font-family: var(--font-heading); font-size: 3rem; font-weight: 600; }
.line-decorator { display: block; width: 50px; height: 2px; background-color: var(--light-glow); margin-right: 1.5rem; }
.vision-content p { font-size: 1.2rem; max-width: 700px; line-height: 1.8; }
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.service-card {
    background: rgba(30, 28, 45, 0.7); /* 少し明るく調整 */
    padding: 2.5rem; border-radius: 15px; border: 1px solid rgba(167, 199, 231, 0.1);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), border-color 0.4s ease, box-shadow 0.4s ease;
    backdrop-filter: blur(8px);
}
.service-card:hover { transform: translateY(-10px); border-color: rgba(167, 199, 231, 0.5); box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
.service-card h3 { font-family: var(--font-heading); font-size: 1.8rem; margin: 1rem 0; font-weight: 600; color: var(--light-glow); }
.site-footer-bottom { text-align: center; padding: 2rem 0; margin-top: 5rem; font-size: 0.9rem; color: rgba(255, 255, 240, 0.5); border-top: 1px solid rgba(167, 199, 231, 0.1); }

/* --- Scroll Animation (ブラー効果) --- */
.reveal {
    opacity: 0; transform: translateY(40px); filter: blur(8px);
    transition: opacity 1.2s cubic-bezier(0.165, 0.84, 0.44, 1), transform 1.2s cubic-bezier(0.165, 0.84, 0.44, 1), filter 1.2s cubic-bezier(0.165, 0.84, 0.44, 1);
    transition-delay: var(--reveal-delay, 0s); will-change: transform, opacity, filter;
}
.reveal.visible { opacity: 1; transform: translateY(0); filter: blur(0px); }

/* 通常時はキャンバス非アクティブ、フォーカス時のみ操作可 */
#three-container { pointer-events: none; }
body.sphere-focus #three-container { pointer-events: auto; }
