/* 全局變數：定義顏色 */
:root {
    --bg-color: #0a0a0a;
    --card-bg: #161616;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --primary: #00f3ff;   /* 電光藍 */
    --secondary: #ff6b00; /* 活力橘 */
    --font-main: 'Poppins', sans-serif;
    --font-code: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-main);
    overflow-x: hidden;
}

/* 導航欄 */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(10px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
    display: flex;
    align-items: center;
    font-family: var(--font-code);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.5), 0 0 20px rgba(0, 243, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.logo:hover {
    text-shadow: 0 0 15px rgba(0, 243, 255, 0.8), 0 0 30px rgba(0, 243, 255, 0.5);
    transform: scale(1.05);
}

.logo img {
    height: 42px;
    width: auto;
    display: block;
    margin-right: 12px;
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li {
    margin-left: 30px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.3s;
    position: relative;
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--secondary);
    transition: width 0.3s;
}

.nav-links a:hover::after {
    width: 100%;
}

.lang-btn {
    border: 1px solid var(--secondary);
    padding: 5px 15px;
    border-radius: 20px;
    color: var(--secondary) !important;
}

.lang-btn:hover {
    background: var(--secondary);
    color: #fff !important;
}

/* Hero Section */
#home {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    background: radial-gradient(circle at center, #1a1a1a 0%, #0a0a0a 70%);
}

.welcome-text {
    font-family: var(--font-code);
    color: var(--secondary);
    font-size: 1.2rem;
    margin-bottom: 10px;
    letter-spacing: 3px;
}

/* Hero name: avoid descender clipping (e.g., g/y/p) on some browsers */
h1 {
    font-size: 5rem;
    margin-bottom: 20px;
    line-height: 1.2;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #888);
    -webkit-background-clip: text;
    color: transparent;
}

/* Extra safe space just for the hero title */
h1.glitch {
    display: inline-block;
    padding-bottom: 0.12em;
}

.typewriter {
    font-size: 1.5rem;
    margin-bottom: 40px;
    color: var(--text-muted);
}

.txt-type {
    color: var(--primary);
    font-family: var(--font-code);
    border-right: 2px solid var(--secondary);
}

.cta-group .btn {
    display: inline-block;
    padding: 12px 30px;
    margin: 0 10px;
    text-decoration: none;
    font-weight: 600;
    border-radius: 5px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}

.btn-secondary {
    border: 2px solid var(--secondary);
    color: var(--secondary);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

/* 通用 Section 樣式 */
.section-padding {
    padding: 100px 10%;
    min-height: 80vh;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 60px;
    position: relative;
    display: inline-block;
    z-index: 1;
}

.section-title::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 5px;
    background: var(--secondary);
    bottom: -10px;
    left: 0;
}

/* Experiences Timeline */
.timeline {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 2px;
    background-color: var(--primary);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -1px;
}

.container {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
}

.left { left: 0; }
.right { left: 50%; }

.content {
    padding: 20px 30px;
    background-color: var(--card-bg);
    border-radius: 6px;
    border-left: 4px solid var(--secondary);
    transition: 0.3s;
}

.content:hover {
    transform: scale(1.02);
    background-color: #222;
}

.content h3 { color: var(--primary); margin-bottom: 5px; font-family: var(--font-code);}
.content h4 { color: #fff; margin-bottom: 10px; }
.content p { color: var(--text-muted); font-size: 0.9rem; }

/* Film Editing Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.film-card {
    background: var(--card-bg);
    height: 250px;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    border: 1px solid #333;
    transition: 0.3s;
    /* 模擬背景圖 */
    background-image: linear-gradient(45deg, #111 25%, #1a1a1a 25%, #1a1a1a 50%, #111 50%, #111 75%, #1a1a1a 75%, #1a1a1a 100%);
    background-size: 20px 20px;
}

.film-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.1);
}

.film-card h3 { z-index: 2; color: #fff; }
.film-card p { z-index: 2; color: var(--secondary); font-size: 0.8rem; font-family: var(--font-code); }

/* Talk Cards */
.cards-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.text-card {
    flex: 1;
    min-width: 300px;
    background: var(--card-bg);
    padding: 40px;
    border-top: 3px solid var(--primary);
    position: relative;
}

.inset-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    align-items: stretch;
}

/* 倒圓角（內凹角）長方框 */
.inset-card {
    background: linear-gradient(135deg, #141414, #0f0f0f);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 38px 44px;
    min-height: 170px;
    position: relative;
    overflow: hidden;
    transition: 0.3s;

    /* 內凹四角：用 mask 切出「倒圓角」 */
    --cut: 18px;
    -webkit-mask:
        radial-gradient(circle at 0 0, transparent var(--cut), #000 calc(var(--cut) + 1px)) top left,
        radial-gradient(circle at 100% 0, transparent var(--cut), #000 calc(var(--cut) + 1px)) top right,
        radial-gradient(circle at 0 100%, transparent var(--cut), #000 calc(var(--cut) + 1px)) bottom left,
        radial-gradient(circle at 100% 100%, transparent var(--cut), #000 calc(var(--cut) + 1px)) bottom right,
        linear-gradient(#000 0 0);
    -webkit-mask-size: 55% 55%, 55% 55%, 55% 55%, 55% 55%, 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask:
        radial-gradient(circle at 0 0, transparent var(--cut), #000 calc(var(--cut) + 1px)) top left,
        radial-gradient(circle at 100% 0, transparent var(--cut), #000 calc(var(--cut) + 1px)) top right,
        radial-gradient(circle at 0 100%, transparent var(--cut), #000 calc(var(--cut) + 1px)) bottom left,
        radial-gradient(circle at 100% 100%, transparent var(--cut), #000 calc(var(--cut) + 1px)) bottom right,
        linear-gradient(#000 0 0);
    mask-size: 55% 55%, 55% 55%, 55% 55%, 55% 55%, 100% 100%;
    mask-repeat: no-repeat;
}

.inset-card:nth-child(1) {
    border: 1px dashed rgba(0, 243, 255, 0.5);
}

.inset-card:nth-child(2) {
    border: 1px solid rgba(255, 107, 0, 0.6);
}

.inset-card::before {
    content: "";
    position: absolute;
    inset: -120px;
    background:
        radial-gradient(circle at 20% 20%, rgba(0, 243, 255, 0.20), transparent 55%),
        radial-gradient(circle at 85% 70%, rgba(255, 107, 0, 0.18), transparent 60%);
    filter: blur(1px);
    opacity: 0.9;
    pointer-events: none;
}

.inset-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 243, 255, 0.35);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.inset-card__tag {
    display: inline-block;
    font-family: var(--font-code);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--secondary);
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.inset-card__title {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: #fff;
    position: relative;
    z-index: 1;
}

.inset-card__desc {
    color: var(--text-muted);
    line-height: 1.8;
    font-size: 1rem;
    position: relative;
    z-index: 1;
    max-width: 70ch;
}

.card-header {
    font-family: var(--font-code);
    color: var(--secondary);
    font-size: 0.8rem;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.read-more {
    display: inline-block;
    margin-top: 20px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
}

/* Professional Skills */
.skills-card {
    max-width: 1000px;
    margin: 0 auto;
    background: linear-gradient(135deg, #121212, #0c0c0c);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 34px 40px;
    position: relative;
    overflow: hidden;
}

.skills-card::before {
    content: "";
    position: absolute;
    inset: -140px;
    background:
        radial-gradient(circle at 25% 20%, rgba(0, 243, 255, 0.14), transparent 60%),
        radial-gradient(circle at 80% 70%, rgba(255, 107, 0, 0.12), transparent 60%);
    pointer-events: none;
}

.skills-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 26px;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 1;
}

.skills-list li {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px 14px 12px 42px;
    border-radius: 14px;
    color: var(--text-main);
    line-height: 1.5;
    position: relative;
}

.skills-list li::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.35);
}

/* Social Responsibility */
.sr-content {
    display: flex;
    align-items: center;
    gap: 50px;
}

.sr-image {
    flex: 1;
    height: 300px;
    background: #222;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #444;
}

.sr-text { flex: 1; }
.sr-text p { line-height: 1.8; color: var(--text-muted); margin-bottom: 20px; }

.tech-stack { list-style: none; display: flex; gap: 10px; }
.tech-stack li {
    background: #333;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-family: var(--font-code);
}

/* Senior Project */
.project-showcase {
    display: flex;
    background: linear-gradient(135deg, #111, #0d0d0d);
    border-radius: 20px;
    padding: 50px;
    border: 1px solid #333;
}

.project-details { flex: 1; padding-right: 40px; }
.project-desc { color: var(--text-muted); margin: 20px 0; line-height: 1.6; }
.stats { display: flex; gap: 40px; margin-bottom: 30px; }
.stats div { display: flex; flex-direction: column; }
.stats .num { font-size: 2.5rem; color: var(--primary); font-weight: 700; }
.stats .label { font-size: 0.8rem; color: #888; text-transform: uppercase; }

.project-visual {
    flex: 1;
    background: #000;
    border-radius: 10px;
    padding: 20px;
    font-family: var(--font-code);
    color: #0f0;
    display: flex;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Contact Section */
.contact-card {
    max-width: 800px;
    margin: 0 auto;
    background: linear-gradient(135deg, #141414, #0f0f0f);
    border: 1px solid rgba(0, 243, 255, 0.2);
    border-radius: 20px;
    padding: 60px 50px;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.contact-card::before {
    content: "";
    position: absolute;
    inset: -150px;
    background:
        radial-gradient(circle at 50% 50%, rgba(0, 243, 255, 0.15), transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(255, 107, 0, 0.1), transparent 50%);
    pointer-events: none;
}

.contact-content {
    position: relative;
    z-index: 1;
}

.contact-icon {
    display: inline-block;
    color: var(--primary);
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

.contact-icon svg {
    filter: drop-shadow(0 0 10px rgba(0, 243, 255, 0.5));
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.contact-title {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 15px;
    font-weight: 700;
}

.contact-desc {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.contact-email {
    display: inline-block;
    font-family: var(--font-code);
    font-size: 1.3rem;
    color: var(--primary);
    text-decoration: none;
    padding: 15px 35px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.contact-email::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary);
    transition: left 0.3s ease;
    z-index: -1;
}

.contact-email:hover {
    color: #000;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
    transform: translateY(-3px);
}

.contact-email:hover::before {
    left: 0;
}

/* Footer */
footer {
    text-align: center;
    padding: 50px;
    border-top: 1px solid #222;
    font-size: 0.9rem;
    color: #666;
}

/* Mobile RWD */
@media screen and (max-width: 768px) {
    .nav-links { display: none; }
    .timeline::after { left: 31px; }
    .container { width: 100%; padding-left: 70px; padding-right: 25px; }
    .left, .right { left: 0; }
    h1 { font-size: 3rem; }
    .sr-content, .project-showcase { flex-direction: column; }
    .project-details { padding-right: 0; margin-bottom: 30px; }
    .inset-cards { grid-template-columns: 1fr; }
    .inset-card { padding: 30px 28px; }
    .skills-card { padding: 26px 22px; }
    .skills-list { grid-template-columns: 1fr; }
    .contact-card { padding: 40px 30px; }
    .contact-title { font-size: 1.5rem; }
    .contact-email { font-size: 1rem; padding: 12px 25px; }
}