/* ===========================
   Design Tokens (design-system.md)
   =========================== */
:root {
    --bg-page:          #000000;   /* neutral-0 */
    --bg-surface:       #0a0a0c;   /* neutral-100 */
    --border-default:   #1e1e24;   /* neutral-300 */
    --text-primary:     #e8e8ec;   /* neutral-950 */
    --text-secondary:   #7e7e8c;   /* neutral-700 */
    --text-muted:       #3d3d48;   /* neutral-500 */
    --glow-effect:      #8e7cb4;   /* glow-400 */
}

/* ===========================
   Reset & Base
   =========================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    height: 100%;
    overflow: hidden;
    font-family: monospace;
    background-color: var(--bg-page);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* ===========================
   Hero Section
   =========================== */
.hero {
    position: relative;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 88px;
    background: var(--bg-page);
}

/* ===========================
   Layer 1: ASCII Art
   =========================== */

/*
 * 設計方針:
 *   - パネルに scaleX(-1) を適用してミラー表現（右パネル）
 *   - フェードは ::before 擬似要素（背景色グラデーション）で実現 → mask-image 不使用
 *     scaleX(-1) により ::before のグラデーション方向も反転し、両パネルで同じ定義が使える
 *   - CSS animation は <pre> ではなく .ascii-fade-wrapper に置く
 *     → JS による textContent 書き換えが animation をリセットする問題を回避
 */
.ascii-surround {
    position: absolute;
    inset: 0;
    pointer-events: none;
    user-select: none;
    opacity: 0;               /* JS が .is-ready を付与するまで非表示 */
    transition: opacity 0.6s ease;
}
.ascii-surround.is-ready {
    opacity: 1;
}

.ascii-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    overflow: hidden;
}

/* 外縁フェード（水平）: 背景色グラデーションで左端を隠す（両パネル共通定義） */
/* 右パネルは scaleX(-1) で反転するため、同じ gradient が右端フェードになる */
.ascii-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(to right, var(--bg-page) 0%, transparent 35%);
}

.ascii-panel--left { left: 0; right: 50%; }

.ascii-panel--right {
    left: 50%;
    right: 0;
    transform: scaleX(-1);   /* パネルごとミラー。art は変換不要 */
}

/* ラッパー: hero-content と垂直中央揃え。内縁（right: 0）で hero-content に接する */
.ascii-fade-wrapper {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(calc(-50% - 4 * clamp(12px, 1.9vw, 16px)));
}

/* 外縁フェード（垂直）: ASCII アート自体の上下端を背景色に溶け込ませる */
.ascii-fade-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(to bottom, var(--bg-page) 0%, transparent 15%, transparent 85%, var(--bg-page) 100%);
}

/* Shared base styles for both layers */
.ascii-art {
    font-family: 'Courier New', 'Lucida Console', monospace;
    font-size: clamp(9px, 1.6vw, 12px);
    letter-spacing: 0.06em;
    line-height: clamp(12px, 1.9vw, 16px);
    white-space: pre;
    display: block;
    margin: 0;
    padding: 0;
}

/* Layer 1: base noise */
.ascii-art--base {
    color: var(--text-muted);
}

/* Layer 2: accent color, overlaid absolutely — band sweeps and flows */
.ascii-art--accent {
    color: #cbc0e6; /* glow-200: グロウエフェクト基準色 */
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* ===========================
   Layer 3: Corner SVGs
   =========================== */
.corner {
    position: absolute;
    pointer-events: none;
    opacity: 0.3;
}
.corner-tl { top: 8px; left: 8px; }
.corner-tr { top: 8px; right: 8px; transform: scaleX(-1); }

/* ===========================
   Layer 4: Hero Content
   =========================== */
.hero-center {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 0 1em 2em;
    font-family: 'JetBrains Mono', monospace;
    background: radial-gradient(ellipse at center, var(--bg-page) 35%, transparent 70%);
}

.hero-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 1.5em 3em;
}

/* タイピングアニメーション */
.typing {
    font-size: 3.2em;
    letter-spacing: 0.08em;
    white-space: nowrap;
    color: var(--text-primary);
    opacity: 0;
}
.typing.resolve {
    opacity: 1;
}


.hero-sub {
    font-size: 0.95em;
    color: var(--text-secondary);
    letter-spacing: 0.12em;
    white-space: nowrap;
    min-height: 1.5em;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 768px) {
    .typing { font-size: 2.2em; }
    .hero-content { padding: 1.5em 2em; }
    .hero-sub {
        font-size: 0.78em;
        letter-spacing: 0.08em;
    }
}

@media (max-width: 480px) {
    .typing { font-size: 1.6em; }
    .hero-content { padding: 1.5em 1.5em; }
    .hero-sub {
        font-size: 0.56em;
        letter-spacing: 0.08em;
    }
}

/* ===========================
   Bottom CTA Button
   =========================== */
.bottom-cta {
    opacity: 0;
    transition: opacity 0.6s ease 0.4s;
}
.bottom-cta.is-visible {
    opacity: 1;
}

.button-link {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78em;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}
.button-link:hover {
    color: var(--text-primary);
}
