/**
 * APM Hero Animation v2.0 — 全滾動驅動版
 * Author: 大郁斜槓工作室
 */

/* ============================
   動畫容器（pin 對象）
   ============================ */
.apm-animation-wrap {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ============================
   Hero Section
   ============================ */
.apm-hero {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* 背景圖 */
.apm-hero__bg {
    position: absolute;
    inset: 0;
    background-color: var(--apm-dark, #0a1628);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: 0;
}

/* 使用者自訂的靜態背景覆蓋 */
.apm-hero__static-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1 !important;
    pointer-events: none !important;
    display: block !important;
}

/* 滾動暗化遮罩（JS 控制） */
.apm-hero__overlay {
    position: absolute;
    inset: 0;
    background: var(--apm-dark, #0a1628);
    opacity: 0;
    z-index: 2;
    pointer-events: none;
}

/* ============================
   粒子（共用 + 4 風格）
   ============================ */
.apm-hero__particles {
    position: absolute;
    inset: 0;
    z-index: 3;
    overflow: hidden;
    pointer-events: none;
}
.apm-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

/* 氣泡 */
.apm-particle--bubble {
    background: radial-gradient(circle at 35% 35%,
        rgba(255, 255, 255, 0.25) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.02) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.08);
    animation: apmFloatBubble linear infinite;
}

/* 科技光點 */
.apm-particle--dot {
    background: radial-gradient(circle, #fff 0%, rgba(255,255,255,0) 70%);
    box-shadow: 0 0 6px 2px rgba(255, 255, 255, 0.3);
    animation: apmFloatDot linear infinite;
}

/* 星塵 */
.apm-particle--star {
    background: #fff;
    box-shadow: 0 0 4px 1px rgba(255, 255, 255, 0.5);
    animation: apmFloatStar linear infinite;
}

/* 波浪粒子 */
.apm-particle--wave {
    background: radial-gradient(circle, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 70%);
    animation: apmFloatWave linear infinite;
}

/* ============================
   Hero 內容
   ============================ */
.apm-hero__content {
    position: relative;
    z-index: 4;
    text-align: center;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    will-change: transform, opacity;
}

.apm-hero__logo-main {
    max-width: clamp(150px, 25vw, 300px);
    max-height: 80px;
}
.apm-hero__logo-main img {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 20px rgba(0, 0, 0, 0.3));
}
.apm-hero__logo-main svg {
    width: 100%;
    height: 100%;
}

.apm-hero__texts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(32px, 5vw, 80px);
}
.apm-hero__text-left,
.apm-hero__text-right {
    font-family: 'Montserrat', -apple-system, sans-serif;
    font-size: clamp(18px, 3vw, 36px);
    font-weight: 300;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
}

.apm-hero__tagline {
    font-family: 'Montserrat', -apple-system, sans-serif;
    font-size: clamp(11px, 1.2vw, 15px);
    letter-spacing: 0.3em;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    margin-top: 8px;
}

/* 滾動提示 */
.apm-hero__scroll {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.apm-hero__scroll span {
    font-family: 'Montserrat', -apple-system, sans-serif;
    font-size: 11px;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}
.apm-scroll-line {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    position: relative;
    overflow: hidden;
}
.apm-scroll-line::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--apm-brand-light, #3d8fd4);
    animation: apmScrollDown 2s ease-in-out infinite;
}

/* 圓形遮罩 */
.apm-circle-mask {
    position: absolute;
    inset: 0;
    background: #fff;
    clip-path: circle(0% at 50% 50%);
    z-index: 10;
    will-change: clip-path;
    pointer-events: none;
}

/* Content Reveal helper */
[data-apm-reveal] {
    opacity: 0;
    transform: translateY(30px);
}

/* ============================
   Keyframes
   ============================ */
@keyframes apmFloatBubble {
    0%   { transform: translateY(110vh) translateX(0) scale(0.6); }
    25%  { transform: translateY(75vh) translateX(18px) scale(0.9); }
    50%  { transform: translateY(40vh) translateX(-12px) scale(1); }
    75%  { transform: translateY(10vh) translateX(15px) scale(0.85); }
    100% { transform: translateY(-15vh) translateX(-8px) scale(0.6); }
}
@keyframes apmFloatDot {
    0%   { transform: translateY(105vh) scale(1); opacity: 0.3; }
    25%  { transform: translateY(75vh) scale(1.2); opacity: 0.8; }
    50%  { transform: translateY(45vh) scale(0.8); opacity: 0.4; }
    75%  { transform: translateY(15vh) scale(1.3); opacity: 0.9; }
    100% { transform: translateY(-10vh) scale(1); opacity: 0.3; }
}
@keyframes apmFloatStar {
    0%   { transform: translateY(105vh) scale(0.5); opacity: 0.2; }
    15%  { opacity: 1; }
    30%  { transform: translateY(70vh) scale(1.2); opacity: 0.3; }
    50%  { transform: translateY(45vh) scale(0.8); opacity: 1; }
    70%  { transform: translateY(20vh) scale(1.5); opacity: 0.2; }
    85%  { opacity: 0.9; }
    100% { transform: translateY(-10vh) scale(0.5); opacity: 0.2; }
}
@keyframes apmFloatWave {
    0%   { transform: translateY(105vh) translateX(0) scale(0.8); }
    20%  { transform: translateY(80vh) translateX(40px) scale(1); }
    40%  { transform: translateY(55vh) translateX(-35px) scale(1.1); }
    60%  { transform: translateY(30vh) translateX(45px) scale(0.9); }
    80%  { transform: translateY(10vh) translateX(-30px) scale(1.05); }
    100% { transform: translateY(-10vh) translateX(10px) scale(0.8); }
}
@keyframes apmScrollDown {
    0%   { top: -100%; }
    50%  { top: 100%; }
    100% { top: 100%; }
}

/* ============================
   Responsive
   ============================ */
@media (max-width: 768px) {
    .apm-hero__texts {
        flex-direction: column;
        gap: 12px;
    }
    .apm-hero__logo-main {
        max-width: 180px;
    }
    .apm-hero__text-left,
    .apm-hero__text-right {
        font-size: 20px;
    }
    .apm-hero__content {
        gap: 16px;
    }
}

/* ============================
   Reduced motion
   ============================ */
@media (prefers-reduced-motion: reduce) {
    .apm-particle {
        display: none;
    }
    .apm-scroll-line::after {
        animation: none;
    }
    .apm-circle-mask {
        clip-path: none;
        background: transparent;
    }
}
