
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
    font-family: 'Inter', 'Noto Sans TC', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-body);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    width: 100%;
    margin: 0; padding: 0;
}

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

:root {
    --bg-body: #F4F7F9;
    --text-dark: #0F172A;
    --text-body: #334155;
    --text-muted: #64748B;
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --accent: #06B6D4;
    --gold: #F59E0B;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.8);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --shadow-glass: 0 10px 30px -5px rgba(15, 23, 42, 0.08);
    --shadow-hover: 0 20px 40px -5px rgba(15, 23, 42, 0.12);
}


.aurora-bg { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: -2; overflow: hidden; background: #F8FAFC; }
.blob { position: absolute; filter: blur(90px); opacity: 0.5; border-radius: 50%; animation: float 20s infinite alternate ease-in-out; z-index: -1; }
.blob-1 { width: 600px; height: 600px; background: #E0E7FF; top: -10%; left: -10%; }
.blob-2 { width: 500px; height: 500px; background: #FCE7F3; top: 40%; right: -10%; animation-delay: -5s; }
.blob-3 { width: 400px; height: 400px; background: #CFFAFE; bottom: -10%; left: 20%; animation-delay: -10s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
    100% { transform: translate(40px, 60px) scale(1.05); }
}


.spotlight-hero {
    position: relative;
    background: linear-gradient(-45deg, #0B1120, #1E293B, #1e1b4b, #0f172a);
    background-size: 400% 400%; animation: gradientBG 15s ease infinite;
    min-height: 90vh; display: flex; align-items: center; overflow: hidden;
    padding: 80px 5%; z-index: 1; width: 100%;
}
@keyframes gradientBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

.glow-orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.6; z-index: -1; animation: pulse 10s infinite alternate ease-in-out; }
.hero-glow-1 { width: 600px; height: 600px; background: #4F46E5; top: -10%; left: -5%; }
.hero-glow-2 { width: 600px; height: 600px; background: #06B6D4; bottom: -20%; right: -10%; }
@keyframes pulse { 0% { transform: scale(1); } 100% { transform: scale(1.2); } }

.hero-container { max-width: 1320px; margin: 0 auto; display: grid; grid-template-columns: 5fr 6fr; gap: 40px; align-items: center; width: 100%; }
.hero-content { color: #FFF; z-index: 10; animation: fadeUp 1s ease forwards; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); backdrop-filter: blur(10px); padding: 8px 20px; border-radius: 100px; font-size: 14px; font-weight: 600; color: #E0E7FF; margin-bottom: 24px; letter-spacing: 1px; }
.fa-crown:before { content: "\f521"; color: #fbd408; }
.hero-title { font-size: 4rem; font-weight: 800; line-height: 1.1; margin-bottom: 16px; letter-spacing: -1px; word-wrap: break-word; }
.hero-subtitle { font-size: 1.5rem; font-weight: 360; color: #afc3df; margin-bottom: 32px; }

.hero-project-box { background: rgba(15, 23, 42, 0.3); border: 1px solid rgba(255, 255, 255, 0.2); border-left: 4px solid var(--accent); padding: 24px; border-radius: var(--radius-md); backdrop-filter: blur(12px); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); }
.hp-title { font-size: 18px; font-weight: 700; color: #FFF; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.hp-tech { font-size: 14px; color: var(--accent); font-family: 'Inter'; font-weight: 600; margin-bottom: 12px; }


.hp-desc, .about-text { 
    color: var(--text-body); 
    font-size: 16px; 
    line-height: 1.8; 
    text-align: justify; 
    text-justify: inter-ideograph; 
    word-break: break-word; 
    letter-spacing: 0.5px;
    margin-bottom: 1.2rem;
}
.hp-desc { color: #CBD5E1; margin-bottom: 0; }

.hero-visual { position: relative; height: 600px; display: flex; justify-content: center; align-items: center; width: 100%; }
.phones-wrapper { position: relative; transform: scale(0.85); z-index: 10; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }
.phone-mockup { position: absolute; width: 280px; height: 606px; background-color: #fff; border-radius: 42px; border: 8px solid #fff; box-shadow: inset 0 0 0 2px #e2e8f0, 0 25px 50px -12px rgba(0, 0, 0, 0.5); overflow: hidden; cursor: pointer; transform: translate(var(--tx), var(--ty)) scale(var(--s)) rotate(var(--r)); transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.5s ease, z-index 0s; opacity: 0; animation: phoneStagger 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes phoneStagger { 0% { opacity: 0; translate: 0 150px; } 100% { opacity: 1; translate: 0 0; } }
.phone-mockup img { width: 100%; height: 100%; object-fit: cover; }
.phone-mockup:hover { transform: translate(var(--tx), calc(var(--ty) - 40px)) scale(calc(var(--s) + 0.05)) rotate(0deg); z-index: 20 !important; box-shadow: 0 40px 80px rgba(0,0,0,0.6); }

.pm-L2 { --tx: -280px; --ty: 60px; --s: 0.7; --r: -18deg; z-index: 1; animation-delay: 0.4s; }
.pm-L1 { --tx: -140px; --ty: 20px; --s: 0.85; --r: -9deg; z-index: 2; animation-delay: 0.2s; }
.pm-C  { --tx: 0px; --ty: -20px; --s: 1; --r: 0deg; z-index: 3; box-shadow: inset 0 0 0 2px #e2e8f0, 0 30px 60px rgba(0,0,0,0.6); animation-delay: 0s; }
.pm-R1 { --tx: 140px; --ty: 20px; --s: 0.85; --r: 9deg; z-index: 2; animation-delay: 0.2s; }
.pm-R2 { --tx: 280px; --ty: 60px; --s: 0.7; --r: 18deg; z-index: 1; animation-delay: 0.4s; }


.sticky-nav-container {
    position: sticky;
    top: 0;
    z-index: 999;
    background: #3339a9;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 40px;
    transition: all 0.3s ease;
}

.sticky-nav {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap; 
    -ms-overflow-style: none; 
    scrollbar-width: none; 
    scroll-behavior: smooth;
    padding: 16px 5% 16px 3%;
    width: 100%;
    max-width: 1460px;
}

.sticky-nav::-webkit-scrollbar { display: none; }

.sticky-nav a {
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    padding: 8px 24px;
    border-radius: 100px;
    transition: all 0.3s ease;
    white-space: nowrap; 
    flex-shrink: 0;
}

.sticky-nav a:hover, .sticky-nav a.active {
    background: var(--primary);
    color: #FFF;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
    transform: translateY(-2px);
}


.nav-scroll-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: none;
    font-size: 20px;
    padding: 0 16px;
    cursor: pointer;
    display: none;
    height: 100%;
    align-items: center;
    transition: color 0.3s;
}

.nav-scroll-btn:hover { color: #FFF; }


.main-layout { max-width: 1320px; margin: 0 auto 80px; padding: 0 2%; display: grid; position: relative; z-index: 20; align-items: start; width: 100%; }
.content-area { display: flex; flex-direction: column; min-width: 0; width: 100%; }

.card { background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--glass-border); border-top: 4px solid #B5B0F6; border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-glass); margin-bottom: 24px; transition: transform 0.4s ease, box-shadow 0.4s ease; scroll-margin-top: 100px; width: 100%; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); background: rgba(255,255,255,0.9); }

.section-title { font-weight: 700; color: var(--text-dark); margin-bottom: 24px; display: flex; align-items: center; gap: 12px; letter-spacing: 0.5px; }
.section-title i { color: var(--primary); background: rgba(79, 70, 229, 0.15); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 16px; }

.highlight { color: var(--primary); font-weight: 700; background: #EEF2FF; padding: 2px 6px; border-radius: 4px; }
.skills-container { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.skill-tag { background:#f8fafc; color: var(--text-dark); padding: 8px 16px; border-radius: 100px; font-size: 13px; font-weight: 600; border: 1px solid rgb(214 212 241); transition: all 0.3s ease; }
.skill-tag:hover { background: #f0efff; border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2); }

.project-group { margin-bottom: 32px; }
.project-group:last-child { margin-bottom: 0; }
.project-group h3 { color: var(--text-dark); font-size: 1.15rem; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; font-weight: 700; border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom: 8px; }
.sdd-indent { padding-left: 12px; }


.intro-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 20px; margin-top: 20px; }
.intro-grid01 { display: grid; gap: 20px; margin-top: 20px; grid-template-columns: repeat(2, 1fr); }

.intro-sub-card { background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(255, 255, 255, 0.9); padding: 24px; border-radius: var(--radius-md); transition: transform 0.3s ease, box-shadow 0.3s ease; box-shadow: 0 4px 15px -5px rgba(15, 23, 42, 0.03); display: flex; flex-direction: column; }
.intro-sub-card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px -5px rgba(15, 23, 42, 0.08); background: rgba(255, 255, 255, 0.85); border-color: rgba(79, 70, 229, 0.3); }
.intro-sub-card h4 { margin-top: 0; color: var(--primary); font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.intro-sub-card .about-text { margin-bottom: 0; font-size: 16px; }
.tag-mini { font-size: 12px; background: rgba(79, 70, 229, 0.1); color: var(--primary); padding: 4px 8px; border-radius: 6px; margin-right: 6px; font-weight: 600; display: inline-block; margin-bottom: 4px; }


.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 16px; border-radius: 12px; }
.typo-table { width: 100%; border-collapse: collapse; background: rgba(255,255,255,0.6); }
.typo-table th, .typo-table td { padding: 16px 20px; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.05); white-space: nowrap; } 
.typo-table th { color: var(--text-muted); font-weight: 600; background: rgba(0,0,0,0.03); text-transform: uppercase; letter-spacing: 1px; }
.typo-table tbody tr { transition: background 0.2s ease; }
.typo-table tbody tr:hover { background: rgba(255, 255, 255, 0.8); }

.diagram-container { width: 100%; background: #FFF; border-radius: var(--radius-md); border: 1px solid rgba(0,0,0,0.05); box-shadow: 0 4px 10px rgba(0,0,0,0.02); overflow: hidden; margin-top: 16px; }
.diagram-img { width: 100%; height: auto; display: block; cursor: zoom-in; transition: transform 0.3s ease; }
.diagram-img:hover { transform: scale(1.02); }


.portfolio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; margin-bottom: 32px; }
.portfolio-item { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid rgba(0,0,0,0.05); background: #FFF; cursor: pointer; position: relative; transition: all 0.4s ease; box-shadow: 0 4px 6px rgba(0,0,0,0.02); display: flex; flex-direction: column; }
.portfolio-item:hover { transform: translateY(-8px); box-shadow: var(--shadow-hover); border-color: rgba(79, 70, 229, 0.3); }
.portfolio-item .img-wrapper { overflow: hidden; width: 100%; height: auto; flex-shrink: 0; }
.portfolio-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.portfolio-item:hover img { transform: scale(1.08); }
.portfolio-item p { padding: 14px 16px; font-size: 15px; text-align: center; color: var(--text-dark); font-weight: 600; background: #FFF; border-top: 1px solid rgba(0,0,0,0.05); margin: 0; transition: color 0.3s; }
.portfolio-item:hover p { color: var(--primary); }


@keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.fade-in-up { opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.fade-in-up.visible { opacity: 1; transform: translateY(0); }

.lightbox { display: none; position: fixed; z-index: 9999; inset: 0; background-color: rgba(0, 0, 0, 0.85); backdrop-filter: blur(10px); align-items: center; justify-content: center; }
.lightbox-content-wrapper { position: relative; max-width: 90%; max-height: 90%; text-align: center; z-index: 100; }
.lightbox-content { max-width: 100%; max-height: 80vh; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); object-fit: contain; }
#lightbox-caption { margin-top: 20px; color: #FFF; font-size: 18px; font-weight: 600; letter-spacing: 1px; }

.lightbox-btn { position: absolute; z-index: 1000; background: rgba(0, 0, 0, 0.5); color: white; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s; backdrop-filter: blur(4px); }
.lightbox-close { top: 30px; right: 40px; width: 48px; height: 48px; border-radius: 50%; font-size: 24px; }
.lightbox-prev, .lightbox-next { top: 50%; transform: translateY(-50%); width: 56px; height: 56px; border-radius: 50%; font-size: 24px; }
.lightbox-prev { left: 40px; }
.lightbox-next { right: 40px; }
.lightbox-btn:hover { background: var(--primary); transform: scale(1.1); }
.lightbox-prev:hover { transform: translateY(-50%) scale(1.1); }
.lightbox-next:hover { transform: translateY(-50%) scale(1.1); }

.btn-top { position: fixed; bottom: 30px; right: 30px; width: 50px; height: 50px; background: var(--text-dark); color: #FFF; border: none; border-radius: 50%; font-size: 20px; cursor: pointer; box-shadow: 0 10px 20px rgba(0,0,0,0.15); opacity: 0; visibility: hidden; transform: translateY(20px); transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); z-index: 1000; }
.btn-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.btn-top:hover { background: var(--primary); transform: translateY(-5px); }


@media (max-width: 1280px) {
    .hero-container { grid-template-columns: 1fr 1fr; }
    .hero-title { font-size: 3.5rem; }
    .phones-wrapper { transform: scale(0.75); }
}

@media (max-width: 1024px) {
    .spotlight-hero { padding: 100px 5% 60px; min-height: auto; }
    .hero-container { grid-template-columns: 1fr; text-align: center; gap: 40px; }
    .hero-project-box { text-align: left; max-width: 720px; margin: 0 auto; }
    .hero-visual { height: 480px; }
    .phones-wrapper { transform: scale(0.7); }
    
    .main-layout { grid-template-columns: 1fr; padding: 0 4%; }
    .portfolio-item .img-wrapper { height: auto; aspect-ratio: 16 / 9; width: 100%; flex-shrink: 0; }
    
  
    .sticky-nav { padding: 12px 2%; gap: 12px; }
    .sticky-nav a { font-size: 15px; padding: 8px 20px; }
}

@media (max-width: 768px) {
    .hero-title { font-size: 2.8rem; }
    .hero-visual { height: 380px; }
    .phones-wrapper { transform: scale(0.6); }
    
    .pm-L2, .pm-R2 { display: none !important; }
    .pm-L1 { --tx: -150px; --ty: 15px; --s: 0.85; --r: -8deg; }
    .pm-R1 { --tx: 150px; --ty: 15px; --s: 0.85; --r: 8deg; }
    .pm-C  { --tx: 0px; --ty: -10px; --s: 1; --r: 0deg; }

    .portfolio-grid { grid-template-columns: 1fr; }
    .lightbox-prev { left: 10px; width: 44px; height: 44px; }
    .lightbox-next { right: 10px; width: 44px; height: 44px; }
    .motion-grid { grid-template-columns: 1fr; }
    .demo-row { flex-direction: column; align-items: stretch; gap: 16px; }
    .sdd-indent { padding-left: 0; }
    .intro-grid01 { grid-template-columns: repeat(1, 1fr); }
}

@media (max-width: 480px) {
    .spotlight-hero { padding: 80px 5% 40px; }
    .hero-title { font-size: 2.2rem; }
    .hero-subtitle { font-size: 1.2rem; margin-bottom: 24px; }
    
    .hero-project-box { padding: 20px; }
    .hp-title { font-size: 16px; align-items: flex-start; }
    
    .hero-visual { height: 300px; }
    .phones-wrapper { transform: scale(0.48); }
    .pm-L1 { --tx: -130px; --ty: 10px; --s: 0.85; --r: -6deg; }
    .pm-R1 { --tx: 130px; --ty: 10px; --s: 0.85; --r: 6deg; }
    
    .card { padding: 24px 16px; }
    .ds-container { padding: 0; }
    .color-spec-grid { grid-template-columns: 1fr 1fr; } 
    .intro-grid01 { grid-template-columns: repeat(1, 1fr); }
}