/* 
    Tianhu Peng - Personal Portfolio
    Theme: Modern, Sleek Dark Mode with Cyber/Robotics aesthetics
*/

/* --- Variables & Theming --- */
:root {
    /* Color Palette */
    --bg-main: #0a0a0f;
    --bg-secondary: #12121c;
    --bg-card: rgba(25, 25, 38, 0.6);
    --bg-card-hover: rgba(35, 35, 52, 0.8);
    
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    
    --accent-primary: #00f0ff; /* Cyber Blue */
    --accent-primary-dim: rgba(0, 240, 255, 0.2);
    --accent-secondary: #7000ff; /* Deep Purple */
    
    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Layout */
    --max-width: 1000px;
    --section-padding: 100px 20px;
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

ul {
    list-style: none;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: #ffffff;
    line-height: 1.2;
}

/* --- Typography utilities --- */
.section-title {
    font-size: clamp(2rem, 5vw, 2.5rem);
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 15px;
}
.section-title span {
    color: var(--accent-primary);
    font-size: 1.2rem;
    font-family: var(--font-body);
    font-weight: 500;
}
.section-title::after {
    content: '';
    display: block;
    height: 1px;
    background: linear-gradient(90deg, var(--bg-card-hover), transparent);
    flex-grow: 1;
    margin-left: 20px;
}

.section-title.center {
    justify-content: center;
}
.section-title.center::after {
    display: none;
}

/* --- Layout utilities --- */
.section {
    padding: var(--section-padding);
}
.bg-secondary {
    background-color: var(--bg-secondary);
}
.section-container {
    max-width: var(--max-width);
    margin: 0 auto;
}
.text-center {
    text-align: center;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 4px;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
}
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--accent-primary-dim);
    z-index: -1;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-base);
}
.btn-primary:hover::before {
    transform: scaleX(1);
}
.btn-primary:hover {
    box-shadow: 0 0 15px var(--accent-primary-dim);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
}
.btn-outline:hover {
    border-color: var(--text-primary);
    background: var(--bg-card);
}

.btn-icon {
    padding: 12px 16px;
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
}
.btn-icon:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-large {
    padding: 16px 40px;
    font-size: 1.1rem;
}

/* --- Navbar --- */
#navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 40px;
    z-index: 100;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
    background: rgba(10, 10, 15, 0.8);
    border-bottom: 1px solid transparent;
}
#navbar.scrolled {
    padding: 15px 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}
.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-primary);
    letter-spacing: -1px;
}
.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
}
.nav-links a {
    font-size: 0.9rem;
    color: var(--text-primary);
    position: relative;
}
.nav-links a:hover {
    color: var(--accent-primary);
}
.btn-nav {
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary) !important;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}
.btn-nav:hover {
    background: var(--accent-primary-dim);
}

/* --- Hero Section --- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding: 0 40px;
}
.glow-bg {
    position: absolute;
    top: 20%;
    left: 10%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, var(--accent-primary-dim) 0%, transparent 60%);
    filter: blur(80px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.5;
}
.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 40px;
    align-items: center;
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    z-index: 1;
}
.hero-content {
    /* adjustment for grid */
}
.hero-content h1 {
    font-size: clamp(3.5rem, 8vw, 5rem);
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -2px;
}

/* Photo Styling */
.hero-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}
.image-border {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    padding: 10px;
    position: relative;
    animation: border-rotate 10s linear infinite;
    background: var(--bg-card);
}
.image-border::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    border-radius: 50%;
    border: 1px dashed var(--accent-primary);
    animation: border-rotate-reverse 15s linear infinite;
}
.image-border img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    transition: transform var(--transition-base);
    background: #000;
}
.hero-image-container:hover img {
    transform: scale(1.05);
}

@keyframes border-rotate {
    100% { transform: rotate(360deg); }
}
@keyframes border-rotate-reverse {
    100% { transform: rotate(-360deg); }
}
/* Glitch effect for name */
.glitch-text {
    position: relative;
    display: inline-block;
}
.glitch-text::before, .glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-main);
}
.glitch-text::before {
    left: 2px;
    text-shadow: -1px 0 red;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
    z-index: -1;
}
.glitch-text::after {
    left: -2px;
    text-shadow: -1px 0 var(--accent-primary);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
    z-index: -2;
}

@keyframes glitch-anim {
  0% { clip: rect(21px, 9999px, 86px, 0); }
  5% { clip: rect(98px, 9999px, 8px, 0); }
  10% { clip: rect(61px, 9999px, 80px, 0); }
  15% { clip: rect(42px, 9999px, 3px, 0); }
  20% { clip: rect(32px, 9999px, 97px, 0); }
  25% { clip: rect(39px, 9999px, 93px, 0); }
  100% { clip: rect(10px, 9999px, 10px, 0); }
}

@keyframes glitch-anim2 {
  0% { clip: rect(18px, 9999px, 12px, 0); }
  5% { clip: rect(35px, 9999px, 3px, 0); }
  10% { clip: rect(78px, 9999px, 60px, 0); }
  15% { clip: rect(78px, 9999px, 20px, 0); }
  20% { clip: rect(64px, 9999px, 21px, 0); }
  25% { clip: rect(18px, 9999px, 13px, 0); }
  100% { clip: rect(0, 9999px, 0, 0); }
}

.hero-content .subtitle {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-weight: 400;
    margin-bottom: 25px;
}
.hero-content .summary {
    max-width: 600px;
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
}
.hero-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* --- Timeline (Education) --- */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}
.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px;
    height: 100%;
    width: 2px;
    background: var(--bg-card-hover);
}
.timeline-item {
    position: relative;
    padding-left: 60px;
    margin-bottom: 50px;
}
.timeline-item:last-child {
    margin-bottom: 0;
}
.timeline-dot {
    position: absolute;
    top: 5px;
    left: 15px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
}
.timeline-date {
    display: inline-block;
    color: var(--accent-primary);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.timeline-content h3 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}
.timeline-content h4 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 15px;
}

/* --- Experience Card --- */
.experience-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    position: relative;
    z-index: 1;
    overflow: hidden;
}
.experience-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), transparent);
}
.experience-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    background: var(--bg-card-hover);
}
.exp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}
.exp-header h3 {
    font-size: 1.5rem;
    color: var(--accent-primary);
}
.exp-header h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-top: 5px;
}
.exp-duration {
    font-family: var(--font-heading);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}
.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}
.skills-list li {
    background: rgba(0, 240, 255, 0.1);
    color: var(--accent-primary);
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
}

/* --- Gallery / Highlights Grid --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
}
.gallery-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    background: var(--bg-card-hover);
}
.gallery-img-wrapper {
    width: 100%;
    height: 220px;
    overflow: hidden;
    position: relative;
    background: #000;
}
.gallery-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.gallery-card:hover .gallery-img-wrapper img {
    transform: scale(1.08);
}
.gallery-info {
    padding: 25px;
}
.gallery-info h3 {
    font-size: 1.25rem;
    color: var(--accent-primary);
    margin-bottom: 12px;
}
.gallery-info p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Clickable gallery cards (external links) */
a.gallery-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
a.gallery-card-link:hover .gallery-info h3 {
    color: #fff;
}
.gallery-ext-icon {
    font-size: 0.75rem;
    opacity: 0.5;
    margin-left: 6px;
    transition: opacity var(--transition-fast);
}
a.gallery-card-link:hover .gallery-ext-icon {
    opacity: 1;
}

/* --- Publications --- */
.publications-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.pub-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 30px;
    transition: all var(--transition-base);
    cursor: pointer;
}
a.pub-card:hover {
    background: rgba(35, 35, 52, 0.9);
    border-color: var(--accent-primary-dim);
    transform: translateX(10px);
}
a.pub-card:hover h3 {
    color: var(--accent-primary);
}
.pub-content {
    max-width: 80%;
}
.pub-meta {
    margin-bottom: 10px;
}
.pub-metrics {
    font-size: 0.85rem;
    color: var(--accent-primary);
    background: rgba(0, 240, 255, 0.1);
    padding: 4px 10px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.pub-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    transition: color var(--transition-base);
}
.pub-authors {
    color: var(--text-secondary);
    font-size: 0.95rem;
}
.pub-link-icon {
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}
a.pub-card:hover .pub-link-icon {
    color: var(--accent-primary);
    transform: rotate(-45deg);
}
.center-btn {
    text-align: center;
    margin-top: 50px;
}

/* --- Contact & Footer --- */
.contact-desc {
    max-width: 600px;
    margin: 0 auto 40px auto;
    font-size: 1.1rem;
    color: var(--text-secondary);
}
.contact-emails {
    display: flex;
    justify-content: center;
    gap: 20px;
}

footer {
    padding: 40px 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.footer-container p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}
.social-links a {
    color: var(--text-secondary);
    font-size: 1.5rem;
    transition: color var(--transition-fast);
}
.social-links a:hover {
    color: var(--accent-primary);
}

/* --- Animations & Utilities --- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-on-load {
    animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Responsive Layout --- */
@media (max-width: 768px) {
    .nav-links {
        display: none; /* simple mobile nav override */
    }
    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
    }
    .hero-actions {
        justify-content: center;
    }
    .hero-content h1 {
        font-size: 3rem;
    }
    .timeline::before {
        left: 0;
    }
    .timeline-item {
        padding-left: 30px;
    }
    .timeline-dot {
        left: -5px;
    }
    .pub-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    .pub-content {
        max-width: 100%;
    }
    .pub-link-icon {
        align-self: flex-end;
    }
    .contact-emails {
        flex-direction: column;
        gap: 15px;
    }
}
